
local function event_cb( e )

	local target = lv.event_get_target( e );

	local cont = lv.event_get_current_target( e );

	if target == cont then

		return;
	end

	lv.obj_set_style_bg_color( target, lv.palette_main( lv.LV_PALETTE_RED ), 0 );
end

local cont = lv.obj_create( lv.scr_act() );

lv.obj_set_size( cont, 290, 200 );

lv.obj_center( cont );

lv.obj_set_flex_flow( cont, lv.LV_FLEX_FLOW_ROW_WRAP );

for i = 0, 29 do

	local btn = lv.btn_create( cont );

	lv.obj_set_size( btn, 80, 50 );

	lv.obj_add_flag( btn, lv.LV_OBJ_FLAG_EVENT_BUBBLE );

	local label = lv.label_create( btn );

	lv.label_set_text( label, string.format( "%d", i ) );

	lv.obj_center( label );
end

lv.obj_add_event_cb( cont, lv.LV_EVENT_CLICKED, event_cb );
